package com.justrun.utils;

import org.apache.shiro.crypto.hash.SimpleHash;

/**
 * sha-256加密工具
 * @author Chandler
 * 2020-09-27
 */
public class EncryptUtil {

    private EncryptUtil(){}

    public final static String HASH_ALGORITHM_NAME = "SHA-256";
    public final static Integer HASH_ITERATORS = 15;

    /**
     * 加密加盐工具方法
     * @param password
     * @param salt
     * @return
     */
    public static String sha256Encrypt(String password,String salt){
        return new SimpleHash(HASH_ALGORITHM_NAME,password,salt,HASH_ITERATORS)
                .toString();
    }
}
